package workers;

import java.util.concurrent.BlockingQueue;

import workerUIs.StepFrame;
import workflow.step.ReleaseStep;
import model.Software;

public class ReleaseStepWorker extends AbstractStepSwingWorker {

	private final BlockingQueue<Software> inputQueue;

	public ReleaseStepWorker(StepFrame frame,
			BlockingQueue<Software> inputQueue) {
		super(frame);
		this.inputQueue = inputQueue;
	}

	@Override
	protected Software doInBackground() throws Exception {
		this.software = this.inputQueue.take();
		new ReleaseStep().doStep(getSoftware());
		return this.software;
	}
	
	@Override
	protected void done() {
		super.done();
		if (inputQueue.isEmpty()) {
			getFrame().getNextButton().setEnabled(false);
		}
	}

}
